<template>
	<view class="scanPopup">
		<uni-popup ref="popup" type="center" :is-mask-click="isMaskClick" :mask-background-color="maskBackgroundColor">
			<view class="popup_content">
				<view class="reset" v-if="popup_Type == 'stop' ">
					<view class="header"> 停止扫描 </view>
					<view class="content"> 是否确认停止扫描？现在停止将<br />无法恢复所有文件</view>
					<view class="btn">
						<view class="item  cancel" @click="confirm_back">停止扫描</view>
						<view class="item confirm" @click="cancel_back">恢复扫描</view>
					</view>
				</view>
				<view class=" reset del" v-if="popup_Type == 'preview'">
					<view class="header"> 提示 </view>
					<view class="content"> 当前正在扫描，确定要停止扫描，<br />预览当前文件吗？ </view>
					<view class="btn">
						<view class="item  cancel" @click="popupClose">继续扫描</view>
						<view class="item confirm" @click="confirm_preview">停止扫描</view>
					</view>
				</view>


				<view class="scanEnd" v-if="popup_Type == 'scanEnd' ">
					<view class="header"> 提示 </view>
					<view class="content"> 扫描结束 </view>
					<view class="btn" @click="popupClose_scanEnd"> 确定 </view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import {
		mapGetters,
		mapMutations,
		mapActions
	} from 'vuex'

	export default {
		data() {
			return {
				isMaskClick: false,
				maskBackgroundColor: "rgba(0,0,0,0.3)",
				popup_Type: null,
				filesType: null,
				listLength: 0
			}
		},
		methods: {
			popupOpen(data) {
				this.popup_Type = data.type
				this.$nextTick(() => {
					this.$refs.popup.open()
				})
			},
			popupClose() {
				this.$refs.popup.close()
			},
			// 确认返回
			cancel_back() {
				this.$refs.popup.close()
				this.$emit("cancel_back")
			},
			// 取消返回
			confirm_back() {
				this.$refs.popup.close()
				this.$emit("confirm_back")
			},



			//扫描结束
			popupClose_scanEnd() {
				this.$refs.popup.close()
				this.$emit("popupClose_scanEnd")
			},
			// 停止扫描，跳入预览界面
			confirm_preview() {
				this.$refs.popup.close()
				this.$emit("confirm_perview")
			}
		}
	}
</script>

<style lang="scss" scoped>
	.popup_content {
		background: #ffffff;
		border-radius: 34.62rpx;
		overflow: hidden;
	}

	.reset {
		width: 519.23rpx;
		height: 394.23rpx;
		overflow: hidden;
		.header {
			text-align: center;
			height: 115.38rpx;
			font-size: 32rpx;
			color: #ffffff;
			line-height: 115.38rpx;
			font-size: 32.69rpx;
			font-weight: 500;
			background: url(../../static/images/resetHeaderBg.png) center center no-repeat;
			background-size: 100% 100%;
		}

		.content {
			font-size: 30.77rpx;
			font-weight: 400;
			color: #666666;
			height: 146.15rpx;
			line-height: 53.85rpx;
			padding-top: 38.46rpx;
			text-align: center;
		}

		.btn {
			display: flex;
			height: 92.31rpx;
			border-top: 2rpx solid #D9D9D9;

			.item {
				flex: 1;
				text-align: center;
				height: 92.31rpx;
				line-height: 92.31rpx;
				font-size: 30.77rpx;
				font-weight: 400;
			}

			.cancel {
				border-right: 2rpx solid #D9D9D9;
				box-sizing: border-box;
				color: #999999;
			}

			.confirm {
				color: #226CFF;
			}
		}
	}
	.scanEnd {
		width: 519.23rpx;
		height: 394.23rpx;

		.header {
			text-align: center;
			height: 115.38rpx;
			font-size: 32rpx;
			color: #ffffff;
			line-height: 115.38rpx;
			font-size: 32.69rpx;
			font-weight: 500;
			background: url(../../static/images/resetHeaderBg.png) center center no-repeat;
			background-size: 100% 100%;
		}

		.content {
			font-size: 30.77rpx;
			font-weight: 400;
			color: #666666;
			height: 146.15rpx;
			line-height: 53.85rpx;
			padding-top: 38.46rpx;
			text-align: center;
		}
		.btn {
			height: 92.31rpx;
			border-top: 2rpx solid #D9D9D9;
			text-align: center;
			height: 92.31rpx;
			line-height: 92.31rpx;
			font-size: 30.77rpx;
			font-weight: 400;
		}
	}
</style>